package com.g001.model.abilities;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;

import com.g001.model.GEntity;


public abstract class Power extends GEntity {
	
	protected Image image;
	protected int value;
	protected int max;
	protected Vector2f position;
	protected boolean look2left;
	
	public Power(final int value, final int max, final Vector2f position) throws SlickException{
		this.position = position.copy();
		image = new Image(64,64);
		this.value = value;
		this.max = max;
		look2left = false;
	}
	
	public Vector2f getPosition() {
		return position;
	}

	public void setPosition(Vector2f position) {
		this.position = position;
	}

	public void add(final int val) {
		if(value+val<=max) value+=val;
		else value = max;
	}
	
	public void remove(final int val) {
		if(value-val>=0) value-=val;
		else value = 0;
	}
	
	public void recharge(){
		value = max;
	}
	
	public void increaseMax(int percentage){
		max += max * percentage / 100;
	}
	
	public void decreaseMax(int percentage){
		max -= max * percentage / 100;
	}

	public boolean isLook2left() {
		return look2left;
	}

	public void setLook2left(boolean look2left) {
		this.look2left = look2left;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}

	

}
